package com.neudu.glsb.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import lombok.Data;

/**
 * 原料信息
 * @TableName ingredients
 */
@TableName(value ="ingredients")
@Data
public class Ingredients implements Serializable {
    /**
     * 主键ID
     */
    @TableId(type = IdType.AUTO)
    private Integer id;

    /**
     * 原料名称
     */
    private String ingredientName;

    /**
     * 采购总量
     */
    private Integer quantity;

    /**
     * 供应商
     */
    private String supplier;

    /**
     * 单位（如千克、升等）
     */
    private String unit;

    /**
     * 当前库存
     */
    private Integer stock;

    /**
     * 库存阈值
     */
    private Integer threshold;

    /**
     * 原料类型（基础原料/小料/包装材料）
     */
    private String ingredientType;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Ingredients other = (Ingredients) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
                && (this.getIngredientName() == null ? other.getIngredientName() == null : this.getIngredientName().equals(other.getIngredientName()))
                && (this.getQuantity() == null ? other.getQuantity() == null : this.getQuantity().equals(other.getQuantity()))
                && (this.getSupplier() == null ? other.getSupplier() == null : this.getSupplier().equals(other.getSupplier()))
                && (this.getUnit() == null ? other.getUnit() == null : this.getUnit().equals(other.getUnit()))
                && (this.getStock() == null ? other.getStock() == null : this.getStock().equals(other.getStock()))
                && (this.getThreshold() == null ? other.getThreshold() == null : this.getThreshold().equals(other.getThreshold()))
                && (this.getIngredientType() == null ? other.getIngredientType() == null : this.getIngredientType().equals(other.getIngredientType()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getIngredientName() == null) ? 0 : getIngredientName().hashCode());
        result = prime * result + ((getQuantity() == null) ? 0 : getQuantity().hashCode());
        result = prime * result + ((getSupplier() == null) ? 0 : getSupplier().hashCode());
        result = prime * result + ((getUnit() == null) ? 0 : getUnit().hashCode());
        result = prime * result + ((getStock() == null) ? 0 : getStock().hashCode());
        result = prime * result + ((getThreshold() == null) ? 0 : getThreshold().hashCode());
        result = prime * result + ((getIngredientType() == null) ? 0 : getIngredientType().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", ingredientName=").append(ingredientName);
        sb.append(", quantity=").append(quantity);
        sb.append(", supplier=").append(supplier);
        sb.append(", unit=").append(unit);
        sb.append(", stock=").append(stock);
        sb.append(", threshold=").append(threshold);
        sb.append(", ingredientType=").append(ingredientType);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}